
# Copyright 2009 David Lee Miller
#
# This file is part of POSSM (Python Open Source Scanning Microscopy).
#
# POSSM is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# POSSM is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License         
# along with POSSM.  If not, see <http://www.gnu.org/licenses/>.
#                                                                           
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

from client import n,m #the numpy package
import random


def makeCircle(asdf,radius,width,centerx,centery,ylim=None,value=1):
	for i in range(asdf.shape[0]):
		for j in range(asdf.shape[1]):
			if -width < (m.sqrt((i-centerx)**2+(j-centery)**2) - radius) < width:
				if ylim != None:
					if ylim[0] < i < ylim[1]: asdf[i,j]=value
					else: pass
				else: asdf[i,j]=value
	return asdf

def makeLine(data,xmin,xmax,ymin,ymax,value=1):
	data[ymin:ymax,xmin:xmax] = value
	return data

def makeRandom(asdf):
	for i in range(asdf.shape[0]):
		for j in range(asdf.shape[1]):
			asdf[i,j] = random.random()
	return asdf

rawr = n.zeros((500,500))
#rawr = makeRandom(rawr)
rawr = makeCircle(rawr,200,6.5,250,250)
rawr = makeCircle(rawr,150,5,250,250,ylim=(0,200),value=0.85)
#rawr = makeLine(rawr,110,390,195,200,value=0.85)
#rawr = makeLine(rawr,248,252,100,200,value=0.85)
#rawr = makeLine(rawr,198,202,110,200,value=0.85)
#rawr = makeLine(rawr,298,302,110,200,value=0.85)
#rawr = makeLine(rawr,148,152,150,200,value=0.85)
#rawr = makeLine(rawr,348,352,150,200,value=0.85)
#rawr = makeLine(rawr,135,365,148,152,value=0.85)
rawr = makeCircle(rawr,20,5,300,200,value=0.75)
rawr = makeCircle(rawr,20,5,300,300,value=0.75)
rawr = makeCircle(rawr,15,5,300,200,value=0.5)
rawr = makeCircle(rawr,15,5,300,300,value=0.5)
rawr = makeCircle(rawr,3,3,300,200,value=0.25)
rawr = makeCircle(rawr,3,3,300,300,value=0.25)